<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>

<script>
//检测插件（在ie中无效）	
function hasPlugin(name){
	
	name=name.toLowerCase();
	
	for(var i=0;i<navigator.plugins.length;i++){
		
		if(navigator.plugins[i].name.toLowerCase().indexOf(name) > -1){
			
			return true;	
		}
	};
	
	return false;
	
};

console.log(hasPlugin('Flash'));//true

console.log(hasPlugin('Viewer'));//true
//检测ie中的插件
function hasIEPlugin(name){
	
	try{
		
		new ActiveXObject(name);	
		
		return true;
		
	}catch(ex){
		
		return false;
	}
};

//检测Flash
console.log(hasIEPlugin('ShockwaveFlash.ShockwaveFlash'));//false

console.log(hasIEPlugin('QuickTime.QuickTime'));//false

//检测所有浏览器中的Flash
function hasFlash(){
	
	var result=hasPlugin('Flash');	
	
	if(!result){
		
		result=hasIEPlugin('ShockwaveFlash.ShockwaveFlash');
	}
	return result;
};

//检测所有浏览器中的QuickTime
function hasQuickTime(){
	
	var result=hasPlugin('QuickTime');	
	
	if(!result){
		
		result=hasIEPlugin('QuickTime.QuickTime');
	}
	return result;
};

console.log(hasFlash());//true;

console.log(hasQuickTime());//false;

</script>
	


</head>

<body>
    
</body>

</html>
